import request from './request'
import { useUserStore } from "../store/modules/user"
// 分页获取商品分类数据下拉列表
export function typePageSelect(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/select/typePageSelect',
        method: 'post',
        headers: token,
        data,
    })
}

// 分页获取品牌数据下拉列表
export function brandPageSelect(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/select/pageSelect',
        method: 'post',
        headers: token,
        data,
    })
}

// 分页获取单位下拉数据列表
export function unitPageSelect(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/select/unitPageSelect',
        method: 'post',
        headers: token,
        data,
    })
}

// 分页获取参数下拉数据列表
export function paramPageSelect(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/select/paramPageSelect',
        method: 'post',
        headers: token,
        data,
    })
}

// 分页获取规格下拉数据列表
export function specPageSelect(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/select/specPageSelect',
        method: 'post',
        headers: token,
        data,
    })
}

// 根据参数ID获取参数字段
export function getParamFields(paramId: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/set/param/getParamFields/' + paramId,
        method: 'get',
        headers: token,
    })
}

// 获取产品列表
export function getProductList(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getList',
        method: 'post',
        headers: token,
        data,
    })
}

// 批量启用或禁用产品
export function productDisable(data: any, status: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/disable',
        method: 'put',
        headers: token,
        data,
        params: { status }
    })
}

// 批量删除产品
export function productDelete(data: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/',
        method: 'delete',
        headers: token,
        data,
    })
}

// 新增或修改产品
export function productSave(data: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/save',
        method: 'post',
        headers: token,
        data,
    })
}

// 根据产品ID获取产品修改前的信息
export function getInfo(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getInfo/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品ID获取产品详情
export function getProductDetail(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductDetail/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品ID获取产品说明书
export function getInsDetail(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductInstructionBook/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品ID获取产品视频
export function getVideoDetail(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductVideo/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品ID获取规格列表
export function getProductSpec(data: any, id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getSpecList/' + id,
        method: 'post',
        headers: token,
        data,
    })
}

// 根据产品ID获取产品参数
export function getProductParam(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductParam/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品ID获取产品说明书列表
export function getInsList(data: any, id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getPorductInstructionBookList/' + id,
        method: 'post',
        headers: token,
        data,
    })
}

// 根据产品ID获取产品视频列表
export function getVideoList(data: any, id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductVideoList/' + id,
        method: 'post',
        headers: token,
        data,
    })
}

// 根据产品ID获取产品简介
export function getIntroduce(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getIntroduce/' + id,
        method: 'get',
        headers: token,
    })
}

// 获取Boom关联的商品列表
export function getGoodsBoomList(data: any, id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getGoodsBoomList/' + id,
        method: 'post',
        headers: token,
        data
    })
}

// 获取配件列表
export function getSpareList(data: object) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getList',
        method: 'post',
        headers: token,
        data,
    })
}

// 新增或修改配件
export function spareSave(data: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/save',
        method: 'post',
        headers: token,
        data,
    })
}

// 批量启用或禁用配件
export function SpareDisable(data: any, status: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/disable',
        method: 'put',
        headers: token,
        data,
        params: { status }
    })
}

// 批量删除配件
export function SpareDelete(data: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/',
        method: 'delete',
        headers: token,
        data,
    })
}

// 根据配件ID获取产品修改前的信息 
export function getSpareInfo(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getInfo/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据配件ID获取配件详情
export function getSpareDetail(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getDetail/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据配件ID获取规格列表
export function getSpareSpec(data: any, id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getSpecList/' + id,
        method: 'post',
        headers: token,
        data,
    })
}

// 根据配件ID获取参数列表
export function getSparePara(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getSpareParam/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据配件ID获取配件简介
export function getSpareIntroduce(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getIntroduce/' + id,
        method: 'get',
        headers: token,
    })
}

// 获取Boom关联的商品列表
export function getSpareBoomList(data: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/spare/getGoodsBoomList',
        method: 'post',
        headers: token,
        data
    })
}

// 获取Boom关联的商品列表
export function saveGoodsBoom(data: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/saveGoodsBoom',
        method: 'post',
        headers: token,
        data
    })
}

// 根据产品ID获取产品Boom清单
export function getProductBoom(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getBoom/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品Boom ID获取产品Boom详情
export function getProductBoomDetail(id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductBoom/' + id,
        method: 'get',
        headers: token,
    })
}

// 根据产品Boom ID获取产品Boom子件列表
export function getProductBoomChildList(data: any, id: any) {
    let token = {
        [useUserStore().row.tokenName]: useUserStore().token
    }
    return request({
        url: '/goods/product/getProductBoomChildList/' + id,
        method: 'post',
        headers: token,
        data,
    })
}